<?php
	$nilai_siswa_detail = array();
	
	foreach($data->result_array() as $row){
		$nilai_siswa_detail = $row;
	}
// var_dump($rpp);
?>

	<!-- BEGIN PAGE -->
	<div class="page-content">
         <!-- BEGIN PAGE CONTAINER-->        
         <div class="container-fluid">
            <!-- BEGIN PAGE HEADER-->
			<div class="row-fluid">
				<div class="span12"> 
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->			
					<h3 class="page-title">
						Form Nilai Siswa <small> menambah dan mengedit nilai siswa</small>
					</h3>
					<ul class="breadcrumb">
						<li>
							<i class="icon-cogs"></i>
							Data Nilai Siswa		
							<i class="icon-angle-right"></i>
						</li>
						<li>
							<a href="<?php echo base_url()?>nilaiSiswaDetail">Nilai Siswa</a>		
							<i class="icon-angle-right"></i>
						</li>
						<li>Form Nilai Siswa</li>	
					</ul>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
            </div>
            <!-- END PAGE HEADER-->
            <!-- BEGIN PAGE CONTENT-->          
            <div class="row-fluid">
               <div class="span12">
                  <!-- BEGIN SAMPLE TABLE PORTLET-->
                  <div class="portlet box green">
                     <div class="portlet-title">
                        <div class="caption"><i class="icon-cogs"></i>Form Nilai Siswa</div>
                     </div>
                     <div class="portlet-body form">
                        <form id="form-nilai-siswa-detail" class="form-horizontal form-bordered form-row-stripped" action="" method="post">		
							<div class="control-group">
                              <label class="control-label">Departemen</label>
                              <div class="controls">
								<?php
									foreach($departemen->result_array() as $row){
										if($departemen_id == $row['departemen_id']){
											echo '<input class="m-wrap span3"type="text" value="'.$row['nama'].'" readonly="readonly" />';
											break;
										}
									}
								?> 
                              </div>
                           </div>	
						   <div class="control-group">
                              <label class="control-label">Tahun Ajaran</label>
                              <div class="controls">
								<?php
									foreach($tahun_ajaran->result_array() as $row){
										if($tahun_ajaran_id == $row['tahun_ajaran_id']){
											echo '<input class="m-wrap span3"type="text" value="'.$row['tahun_ajaran_id'].'" readonly="readonly" />';
											break;
										}
									}
								?>
                              </div>
                           </div>
						   <div class="control-group">
                              <label class="control-label">Semester</label>
                              <div class="controls">
                                 <?php
									foreach($semester->result_array() as $row){
										if($semester_id == $row['semester_id']){
											echo '<input class="m-wrap span3"type="text" value="'.$row['semester'].'" readonly="readonly" />';
											break;
										}
									}
								?>
                              </div>
                           </div>
						   <div class="control-group">
                              <label class="control-label">Kelas</label>
                              <div class="controls">
                                 <input type="hidden" name="data[kelas_id]" value="<?php echo $kelas_id ?>" />
								<?php
									foreach($kelas->result_array() as $row){
										if($kelas_id == $row['tingkat_id']){
											echo '<input class="m-wrap span3"type="text" value="'.$row['tingkat'].'" readonly="readonly" />';
											break;
										}
									}
								?>
                              </div>
                           </div>
								<div class="control-group">
									<label class="control-label">Siswa</label>
									  <div class="controls">
										 <select class="span6 m-wrap large" name="data[nilai_semester_id]" data-placeholder="Choose a Category" tabindex="1">
											<option value="">------- Pilih Siswa -------</option>
											<?php foreach($siswa->result_array() as $row){?>
											 <option value="<?php echo $row['siswa_id']?>" <?php echo isset($nilai_siswa['siswa_id']) && $nilai_siswa['siswa_id'] == $row['nilai_semester_id']?'selected="selected"':''?>><?php echo $row['nama']?></option>
											<?php } ?>
										</select>
									</div>
								</div>
							<div class="control-group">
							<div class="row-fluid">
								<div class="span5">
								<div class="controls">
									<label class="control-label" >Kepribadian Siswa:</label>
								</div>
								<label class="control-label" >Sikap:</label>
								<div class="controls">
									<input class="m-wrap span12" id="sikap" name="data[sikap]" type="text" value=""   />
								</div>
								<label class="control-label" >Kerajinan:</label>
								<div class="controls">
									<input class="m-wrap span12" id="kerajinan" name="data[kerajinan]" type="text" value=""   />
								</div>
								<label class="control-label" >Kebersihan dan Kerapian:</label>
								<div class="controls">
									<input class="m-wrap span12" id="kebersihan" name="data[kebersihan]" type="text" value=""   />
								</div>
								</div>
							</div>
							</div>
							
							<div class="control-group">
							<div class="row-fluid">
								<div class="span5">
								<div class="controls">
									<label class="control-label" >Ketidak Hadiran Siswa:</label>
								</div>
								<label class="control-label" >Izin:</label>
								<div class="controls">
									<input class="m-wrap span12" id="izin" name="data[izin]" type="text" value=""   />
								</div>
								<label class="control-label" >Sakit:</label>
								<div class="controls">
									<input class="m-wrap span12" id="sakit" name="data[sakit]" type="text" value=""   />
								</div>
								<label class="control-label" >Tanpa Keterangan:</label>
								<div class="controls">
									<input class="m-wrap span12" id="alfa" name="data[alfa]" type="text" value=""   />
								</div>
								</div>
							</div>
							</div>
							
							<div class="control-group">
							<div class="row-fluid">
								<div class="span5">
								<div class="controls">
									<label class="control-label" >Pengembangan Diri:</label>
								</div>
								<label class="control-label" >Jenis Kegiatan:</label>
								<div class="controls">
									<input class="m-wrap span12" id="pd1" name="data[pd1]" type="text" value=""   />
								</div>
								<div class="controls">
									<input class="m-wrap span12" id="pd2" name="data[pd2]" type="text" value=""   />
								</div>
								<div class="controls">
									<input class="m-wrap span12" id="pd3" name="data[pd3]" type="text" value=""   />
								</div>
								</div>
								<div class="span5">
								<div class="controls">
									<label class="control-label" >Nilai Pengembangan Diri:</label>
								</div>
								<label class="control-label" >Nilai</label>
								<div class="controls">
									<input class="m-wrap span12" id="npd1" name="data[npd1]" type="text" value=""   />
								</div>
								<div class="controls">
									<input class="m-wrap span12" id="npd2" name="data[npd2]" type="text" value=""   />
								</div>
								<div class="controls">
									<input class="m-wrap span12" id="npd3" name="data[npd3]" type="text" value=""   />
								</div>
								</div>
							</div>
							</div>
						    <div class="control-group">
                              <label class="control-label">Catatan Guru</label>
                              <div class="controls">
                                 <textarea class="span6 m-wrap" name="data[catatan_wali_kelas]" rows="5"><?php echo isset($nilai_siswa_detail['catatan_wali_kelas'])?$nilai_siswa['catatan_wali_kelas']:''?></textarea>
                              </div>
                           </div>
							<div class="form-actions">
							   <button type="submit" class="btn blue"><i class="icon-ok"></i> SIMPAN</button>
							   <a href="<?php echo base_url()?>nilaiSiswaDetail" class="btn">BATAL</a>
							</div>
						</form>
                     </div>
                  </div>
                  <!-- END SAMPLE TABLE PORTLET-->
               </div>              
            </div>
           
            <!-- END PAGE CONTENT-->
         </div>
         <!-- END PAGE CONTAINER-->
    </div>
    <!-- END PAGE -->
	<script>
		$(document).ready(function(){
			$("#form-nilai-siswa-detail").validate(
				{
					errorElement: 'span', //default input error message container
					errorClass: 'help-inline', // default input error message class
					focusInvalid: false, // do not focus the last invalid input
					ignore: "",
					highlight: function (element) { // hightlight error inputs
						$(element)
							.closest('.help-inline').removeClass('ok'); // display OK icon
						$(element)
							.closest('.control-group').removeClass('success').addClass('error'); // set error class to the control group
					},

					unhighlight: function (element) { // revert the change dony by hightlight
						$(element)
							.closest('.control-group').removeClass('error'); // set error class to the control group
					},

					success: function (label) {
						label
							.addClass('valid').addClass('help-inline ok') // mark the current input as valid and display OK icon
						.closest('.control-group').removeClass('error').addClass('success'); // set success class to the control group
					}
				}
			);
		});
	</script>